//
// test.cpp for  in /home/lund/Projets/pizzaillo
// 
// Made by florian dewulf
// Login   <dewulf_f@epitech.net>
// 
// Started on  Tue Apr 16 09:53:45 2013 florian dewulf
// Last update Tue Apr 16 17:09:24 2013 florian dewulf
//

#include	<iostream>
#include	<unistd.h>
#include	"Fifo.hpp"

using namespace std;

int		main()
{
  Fifo		toto("test");
  int		pid;
  string	tutu;

  pid = fork();
  if (pid == 0)
    {
      toto.open_in();
      cout << "Pid fils = " << pid << endl;
      toto >> tutu;
      toto >> tutu;
      tutu = "";
      int	i = 0;
      while (tutu == "")
	{
	  cout << "Boucle, i = " << i << endl;
	  toto >> tutu;
	}
      cout << "quit fils" << endl;
      return (0);
    }
  else
    {
      toto.open_out();
      cout << "Pid père = " << pid << endl;
      sleep(1);
      toto << "tutu";
      sleep(1);
      toto << "titi";
      sleep(1);
      cout << "begin sleep" << endl;
      sleep(2);
      cout << "end sleep" << endl;
      toto << "toto";
      cout << "quit pere" << endl;
      return (0);
    }
}
